x86: Enable GNTTABOP_copy hypercall for HVMs
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 5 Aug 2009 12:49:35 +0000 (13:49 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 5 Aug 2009 12:49:35 +0000 (13:49 +0100)
This requires plumbing 32-bit compat guests through the compat version
of teh grant-table hypercall.

Signed-off-by: Jayaraman, Bhaskar <Bhaskar.Jayaraman@lsi.com>
xen/arch/x86/hvm/hvm.c
xen/include/xen/hypercall.h

index 1716b14b2ddbd160776dc4c43569b8646168b566..16f59b2780d9f29753f6a696c7bd3e4a89d8efa4 100644 (file)
@@ -1999,7 +1999,8 @@ static long hvm_grant_table_op(
     unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count)
 {
     if ( (cmd != GNTTABOP_query_size) && (cmd != GNTTABOP_setup_table) &&
-         (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) )
+         (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) &&
+         (cmd != GNTTABOP_copy))
         return -ENOSYS; /* all other commands need auditing */
     return do_grant_table_op(cmd, uop, count);
 }
@@ -2051,6 +2052,16 @@ static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {
 
 #else /* defined(__x86_64__) */
 
+static long hvm_grant_table_op_compat32(
+    unsigned int cmd, XEN_GUEST_HANDLE(void) uop, unsigned int count)
+{
+    if ( (cmd != GNTTABOP_query_size) && (cmd != GNTTABOP_setup_table) &&
+         (cmd != GNTTABOP_map_grant_ref) && (cmd != GNTTABOP_unmap_grant_ref) &&
+         (cmd != GNTTABOP_copy))
+        return -ENOSYS; /* all other commands need auditing */
+    return compat_grant_table_op(cmd, uop, count);
+}
+
 static long hvm_memory_op_compat32(int cmd, XEN_GUEST_HANDLE(void) arg)
 {
     long rc = compat_memory_op(cmd, arg);
@@ -2090,7 +2101,7 @@ static hvm_hypercall_t *hvm_hypercall64_table[NR_hypercalls] = {
 
 static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {
     [ __HYPERVISOR_memory_op ] = (hvm_hypercall_t *)hvm_memory_op_compat32,
-    [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op,
+    [ __HYPERVISOR_grant_table_op ] = (hvm_hypercall_t *)hvm_grant_table_op_compat32,
     [ __HYPERVISOR_vcpu_op ] = (hvm_hypercall_t *)hvm_vcpu_op_compat32,
     HYPERCALL(xen_version),
     HYPERCALL(event_channel_op),
index f2e0150fa1d72eca77108ccf663ab668d9d60c49..5d151226e9833b15ac2475e43d75f0b3ea446596 100644 (file)
@@ -128,6 +128,12 @@ compat_memory_op(
     unsigned int cmd,
     XEN_GUEST_HANDLE(void) arg);
 
+extern int
+compat_grant_table_op(
+    unsigned int cmd,
+    XEN_GUEST_HANDLE(void) uop,
+    unsigned int count);
+
 extern int
 compat_vcpu_op(
     int cmd,